home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.sys.sgi.apps,comp.lang.c++
- Subject: Re: SGI's C++ compiler and the boolean type
- Date: Sat, 20 Apr 1996 02:37:25 GMT
- Organization: Netcom
- Message-ID: <31784d88.187788215@nntp.ix.netcom.com>
- References: <4kefm7$oao@ncar.ucar.edu> <4kg6fv$h7k@nic.ftns.no> <31770390.2781@llnl.gov>
- NNTP-Posting-Host: ix-dc12-18.ix.netcom.com
- X-NETCOM-Date: Fri Apr 19 9:34:34 PM CDT 1996
- X-Newsreader: Forte Agent .99d/32.182
-
- Scott Nelson <nelson18@llnl.gov> wrote:
-
- > Arthur Hagen wrote:
- > >
- > > >
- > > > typedef int bool;
- > > > #define true 1
- > > > #define false 0
- > >
- > > And some argue that true should be -1, because then bitwise not works:
- > >
- >
- > We use the following. It's safe on all platforms:
- >
- > #define FALSE 0
- > #define TRUE (!0)
- >
- > Let the built-in ! operator determine what TRUE really is.
-
- How is that safer than
-
- #define FALSE 0
- #define TRUE 1
-
- !0 is guaranteed to be 1 in both C and C++.
-
-
- Michael M Rubenstein
-